﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DatabaseToCode.Schema
{
    public class Column
    {
        public string Name { get; set; }
        public string DisplayName { get; set; }
        public string FieldName { get { return this.DisplayName.Replace(" ", string.Empty); } }
        public string DatabaseType { get; set; }
        public int? MaxLength { get; set; }
        public Type ManagedType { get; set; }
        public bool AllowsNull { get; set; }
        public bool IsKey { get; set; }
        //public long? AutoIncrement { get; set; }
        //public long? AutoIncrementSeed { get; set; }
        
        public int Ordinal { get; set; }

        public bool IsNullableValueType {
            get { 
                return this.ManagedType.IsValueType && this.AllowsNull;
            }
        }
    }
}
